{extend name="Base" /}
{block name="title"}{$title}{/block}
{block name="body"}
<legend>{$title}</legend>
<table class="am-table am-table-bordered am-table-centered">
	<thead>
	<tr>
		<th colspan="2"><i class="am-icon-th-list" title="标题"></i></th>
		<th class="am-show-md-up"><i class="am-icon-th" title="种子大小"></i></th>
		<th class="am-show-md-up"><i class="am-icon-check" title="完成数"></i></th>
		<th><i class="am-icon-arrow-up" title="做种数"></i></th>
		<th class="am-show-md-up"><i class="am-icon-arrow-down" title="下载数"></i></th>
	</tr>
	</thead>
	<tbody>
	{volist name="series" id="ss"}
	<tr class="am-text-middle">
		<td rowspan="{$ss.son_num}" class="am-text-middle am-text-nowrap">{$ss.subtitle}</td>
		{volist name="$ss.son" id="s"}
		<td class="am-text-nowrap">
			<div class="am-fl"><a href="/series/id/{$s.id}" target="_blank" title="{$s.maintitle}">{$s.container|getContainer} / {$s.source|getSource} / {$s.resolution|getResolution}</a></div>
			<div class="am-fr">
				{if condition="!empty($s.logscore)"}
				<span>Log:{$s.logscore}%</span>
				{elseif condition="!empty($s.imdbscore)"}
				<a href="{$s.imdburl}" target="_blank" rel="nofollow">IMDb:{$s.imdbscore}</a>
				{/if}
				<a href="/report/{$s.id}/s" title="反馈种子"><i class="am-icon-exclamation-circle"></i></a>
				<a href="javascript:void(0)" onclick="addCart(this.name, 's')" title="加入小货车" name="{$s.id}">
					{if condition="$s.rss neq 1"}
					<i class="am-icon-cart-plus cart-{$s.id}"></i>&nbsp;
					{else /}
					<i class="am-icon-cart-plus cart-{$s.id}" style="color: #0e90d2"></i>&nbsp;
					{/if}
				</a>
				<a href="/dl/s/{$s.id}/{$ss.uuid}" title="下载种子"><i class="am-icon-arrow-circle-o-down"></i>&nbsp;</a>
			</div>
		</td>
		<td class="am-text-middle am-text-nowrap am-show-md-up">{$s.torrentsize|getSize}</td>
		<td class="am-text-middle am-text-nowrap am-show-md-up">{$s.completed}</td>
		<td class="am-text-middle am-text-nowrap">{$s.seeder}</td>
		<td class="am-text-middle am-text-nowrap am-show-md-up">{$s.leecher}</td>
	</tr>
	{/volist}
	{/volist}
	</tbody>
</table>
<div class="am-modal am-modal-alert" tabindex="-1" id="my-alert">
	<div class="am-modal-dialog">
		<div class="am-modal-hd">错误</div>
		<div class="am-modal-bd">失败</div>
		<div class="am-modal-footer">
			<span class="am-modal-btn" data-am-modal-confirm>知道了</span>
		</div>
	</div>
</div>
<br/>
<script>
	function addCart(id, type) {
		var data = {
			id: id,
			type: type
		};
		var $bd = $(".am-modal-bd");
		var $cartid = $(".cart-" + id);
		$.ajax({
			type: "POST",
			url: "/index/truck/index",
			cache: false,
			data: data,
			dataType: "json",
			success: function (data) {
				if (data.status === 0) {
					if (data.message) {
						$bd.html(data.message);
					}
					$("#my-alert").modal();
				} else if (data.status === 1) {
					$(".am-modal-hd").html("成功");
					$bd.html(data.message);
					$cartid.css("color", "#0e90d2");
					$("#my-alert").modal();
				} else if (data.status === 2) {
					$(".am-modal-hd").html("成功");
					$bd.html(data.message);
					$cartid.css("color", "");
					$("#my-alert").modal();
				} else {
					$bd.html("系统故障，请稍候再试");
					$("#my-alert").modal();
				}
			}
		});
	}
</script>
{/block}